{{ define "main" }}
<div id="myjj" class="container-fluid">
    <div id="carouselIndexSlides" class="carousel slide" data-bs-ride="carousel">
        <div class="carousel-inner text-center">
            <div class="carousel-item active">
                {{ with .Content }}
                {{ . }}
                {{ end }}
            </div>
            {{ range .Site.Params.Text }}
            <div class="carousel-item text-truncate">
                <p><span>✨</span>{{ .content }}</p>
            </div>
            {{ end }}
        </div>
    </div>
</div>

{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $projects := where .Site.RegularPages "Section" "projects" }}
{{ $pages = .Paginate ($pages)  }}
{{ $archivesPage := first 1 (where .Site.RegularPages "Layout" "eq" "archives") }}

<div class="container">
    <h2>最新文章<span class="badge bg-light">
        {{ range $archivesPage }}
        <a class="link-dark links" href="{{ .RelPermalink }}">查看所有</a>
        {{ end }}
    </span><hr></h2>
    <div class="row">
        {{ range $pages.Pages }}        
        <div class="col-12 post text-truncate">
            <a class="link-dark links" href="{{ .RelPermalink }}"><time>{{ .Date.Format "2006-01-02" }}</time>{{ .Title }}</a>
        </div>
        {{ end }}
    </div>
</div>

{{ if gt (len $projects) 0}}
<div class="container">
    <h2>项目</h2><hr>
    {{ range $projects.ByWeight }}
    <div class="card xm">
        <div class="card-header">
            {{ .Title }}
        </div>
        <div class="card-body">
            <!-- <h5 class="card-title">Special title treatment</h5> -->
            <p class="card-text">{{ .Params.description }}</p>
            <a href="{{ .Params.repo }}" target="_blank" class="btn btn-primary">Source</a>
        </div>
    </div>
    {{ end }}
</div>
{{ end }}

{{ end }}
